Imports Microsoft.VisualBasic
'this page scans the file system to find the available themes(under App_Theme folder)
Public Class Helpers
    'summary:returns an array with the names of all local Themes

    Public Shared Function GetThemes() As String()
        If Not IsNothing(HttpContext.Current.Cache("SiteThemes")) Then
            Return HttpContext.Current.Cache("SiteThemes")
        Else
            Dim ThemesPath As String
            ThemesPath = HttpContext.Current.Server.MapPath("~/App_Themes")
            'get the array of themes folders under the /app_Themes
            Dim Themes() As String
            Themes = System.IO.Directory.GetDirectories(ThemesPath)
            For i As Integer = 0 To Themes.GetUpperBound(0)
                Themes(i) = System.IO.Path.GetFileName(Themes(i))
            Next
            'cache the array with a depedency to the folder
            Dim dep As New CacheDependency(ThemesPath)
            HttpContext.Current.Cache.Insert("SiteThemes", Themes, dep)
            Return Themes
        End If
    End Function

    'Public Shared Sub SetInputControlsHighlight(ByVal container As Control, ByVal className As String, ByVal onlyTextBoxes As Boolean)
    '   For Each ctl As Control In container.Controls
    '      If ((onlyTextBoxes And TypeOf (ctl) Is TextBox) Or (TypeOf (ctl) Is TextBox) Or (TypeOf (ctl) Is DropDownList) Or (TypeOf (ctl) Is ListBox) Or (TypeOf (ctl) Is CheckBox) Or (TypeOf (ctl) Is RadioButton) Or (TypeOf (ctl) Is RadioButtonList) Or (TypeOf (ctl) Is CheckBoxList)) Then
    'Dim wctl As WebControl
    '           wctl = ctl
    '          wctl.Attributes.Add("onfocus", String.Format("Me.className = '{0}';", className))
    '         wctl.Attributes.Add("onblur", "this.className=''")
    '
    '           ElseIf (ctl.Controls.Count > 0) Then
    '              SetInputControlsHighlight(ctl, className, onlyTextBoxes)
    '         End If
    '    Next
    'End Sub

End Class
